/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (almaslvl@gmail.com).
 * See LICENSE for details.
 */

package com.windea.study.kotlin.fxgl.sample.sandbox.saving

import com.almasb.fxgl.entity.component.*
import com.almasb.fxgl.entity.components.*

/**
 * @author Almas Baimagambetov (AlmasB) (almaslvl@gmail.com)
 */
class PlayerControl : Component() {
	private var position: TransformComponent = TransformComponent()
	
	private var speed = 0.0
	
	
	override fun onUpdate(tpf: Double) {
		speed = tpf * 60
	}
	
	fun up() {
		position.translateY(-5 * speed)
	}
	
	fun down() {
		position.translateY(5 * speed)
	}
	
	fun left() {
		position.translateX(-5 * speed)
	}
	
	fun right() {
		position.translateX(5 * speed)
	}
}
